#ifndef _FILES_H_CSEAPI_
#define _FILES_H_CSEAPI_

class TCharArray;  // forward declare

extern TCharArray GetCurrExeFileName();
extern TCharArray ChangeFileExt(const TCharArray& sFile, const TCharArray& ext);
extern TCharArray ExtractFileExt(const TCharArray& FileName);
extern TCharArray ExtractFileName(const TCharArray& FileName);
extern TCharArray ExtractFileDir(const TCharArray& FileName);
extern TBool FileExists(const TXchar *FileName);
extern TBool DirExists(const TXchar *DirName);
extern TCharArray NormalizeFileName(const TCharArray& sFile);
extern TBool SearchSubDirs(TCharArray& sOut, const TCharArray& dir);

extern const long HKey_ClassesRoot;    // HKEY_CLASSES_ROOT
extern const long HKey_CurrentUser;    // HKEY_CURRENT_USER
extern const long HKey_users;          // HKEY_USERS
extern const long HKey_LocalMachine;   // HKEY_LOCAL_MACHINE;

// root and path example:
//   root: HKEY_CURRENT_USER
//   path: Software\VendorName\AppName
//         Software\CseSoft\CseKernel20

class TRegConfig
{
private:
    TXchar *m_path;
    long m_hRootKey;
    long m_hKey;

    TBool open();
    TBool close();
    
public:
    TRegConfig(long root, const TXchar *path);
    ~TRegConfig();

    TBool read(const TXchar *name, char *out, TUint32& iLen);
};

class TDllFile
{
private:
    void *m_handle;

public:
    TDllFile(const TXchar *file);
    ~TDllFile();

    static void *loadLib(const TXchar *file);
    static void unloadLib(void *handle);

    TBool isLoaded();
    void attach(void * handle);
    void *detach();
    void *getSymbol(const TXchar *name);
};

#endif
